<html>
<head><meta charset="utf-8"><title>Digit Parsing Improvements · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Digit.20Parsing.20Improvements.html">Digit Parsing Improvements</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="246334480"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Digit%20Parsing%20Improvements/near/246334480" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ruster <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Digit.20Parsing.20Improvements.html#246334480">(Jul 17 2021 at 17:18)</a>:</h4>
<p>The recently merged <a href="https://github.com/rust-lang/rust/pull/86761">https://github.com/rust-lang/rust/pull/86761</a> mentions digit parsing improvements:</p>
<blockquote>
<p>Digit Parsing Improvements</p>
<p>Typically, integers are parsed from string 1-at-a-time, requiring unnecessary multiplications which can slow down parsing. An approach to parse 8 digits at a time using only 3 multiplications is described in length <a href="https://johnnylee-sde.github.io/Fast-numeric-string-to-int/">here</a>. This leads to significant performance improvements, and is implemented for both big and little-endian systems.</p>
</blockquote>
<p>Has it been considered to apply that to normal string to integer parsing in core as well? It appears that currently the core library does the slower thing of parsing one digit at a time: <a href="https://doc.rust-lang.org/src/core/num/mod.rs.html#877">https://doc.rust-lang.org/src/core/num/mod.rs.html#877</a></p>



<a name="246334500"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Digit%20Parsing%20Improvements/near/246334500" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ruster <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Digit.20Parsing.20Improvements.html#246334500">(Jul 17 2021 at 17:19)</a>:</h4>
<p>There's many other interesting algorithms on that site too for faster conversions of things: <a href="https://johnnylee-sde.github.io/">https://johnnylee-sde.github.io/</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>